# syntax=docker/dockerfile:1

FROM golang:1.23 as builder
WORKDIR /app

COPY go.work ./
COPY shared ./shared
COPY proto ./proto
COPY services ./services

WORKDIR /app/services/alert-service
RUN --mount=type=cache,target=/go/pkg/mod \
    --mount=type=cache,target=/root/.cache/go-build \
    go build -o /out/alert-service ./cmd

FROM gcr.io/distroless/base-debian12
WORKDIR /app
COPY --from=builder /out/alert-service /app/alert-service
EXPOSE 50051
ENTRYPOINT ["/app/alert-service"]
